import Koa from 'koa'
import path from 'path'
import { fileURLToPath } from 'url'

import { koaBody } from 'koa-body'

import koaStatic from 'koa-static'

import router from './router/index.js'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const app = new Koa()

const publicDirectory = path.join(__dirname, 'public')

app.use(koaBody())
app.use(koaStatic(publicDirectory))

router(app)

app.listen(3030)

console.log(`http://127.0.0.1:3030`)
// console.log(`http://127.0.0.1:3030/grok/upload`)
console.log(`http://127.0.0.1:3030/db/upload`)
// console.log(`http://127.0.0.1:3000/gpt/upload`)
